home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8628 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: rain.fr!world-net!usenet
  2. From: Frederic LACHASSE <lachass@worldnet.fr>
  3. Newsgroups: comp.lang.c++,gnu.g++,gnu.g++.help
  4. Subject: Re: Overloaded new operator in C++
  5. Date: Sun, 18 Feb 1996 18:02:34 +0000
  6. Organization: World-Net information exchange, Internet provider.
  7. Message-ID: <VA.00000043.00701e8f@fred>
  8. References: <4g0boe$c37@maverick.tad.eds.com>
  9. Reply-To: lachass@worldnet.fr
  10. NNTP-Posting-Host: client56.sct.fr
  11. X-Newsreader: Virtual Access by Ashmount Research Ltd, http://www.ashmount.com
  12.  
  13. In article <4g0boe$c37@maverick.tad.eds.com>, 
  14. venkat@nemesis.pln.rboc.eds.com (User Jdsmith) wrote:
  15. > I am experiencing a problem with overloading the 
  16. > new operator when allocating an array of classes.
  17. >
  18. > I do the following and my overloaded new operator is
  19. > called as expected:
  20. >
  21. > ptr = new ClassThatOverloadsNew;
  22. >
  23. > But when I do this:
  24. >
  25. > ptr = new ClassThatOverloadsNew[5];
  26. >
  27. > The default new operator is called.
  28.  
  29. Some compiler (generally new genaration ones) like Borland C++ 4.02 and 
  30. 4.5,  operator new and operator new[] are different, so you need to 
  31. overload both.
  32.  
  33. I hope this'll help.
  34.  
  35.  Frederic LACHASSE (ECP 86)
  36.  CompuServe: 100530,2005
  37.  Internet: lachass@worldnet.fr
  38.  
  39.